<link rel="stylesheet" type="text/css" media="all" href="/static/assets/css/daterangepicker-bs3.css" />
<!--<script type="text/javascript" src="/static/assets/js/jquery-1.8.3.min.js"></script>-->
<!--<script type="text/javascript" src="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>-->
<script type="text/javascript" src="/static/assets/js/moment.js"></script>
<script type="text/javascript" src="/static/assets/js/daterangepicker.js"></script>
<input hidden="hidden" id="navValue" value="营销分">
<div class="page-content">
    <div class="page-header">
        <h1>
            账户资产
            <small>
                <i class="ace-icon fa fa-angle-double-right"></i>
                全部营销分记录
            </small>
        </h1>
    </div><!-- /.page-header -->
    <div class="row">
        <from id="from_post" class="form-horizontal user-data" action="{:url('Marketing/info')}" method="POST">
            <div class="form-group">
                <div class="col-md-3 no-margin-right no-padding-right" style="line-height: 13px;">
                    <label class="col-sm-4 control-label no-padding-right" for="form-field-1"> 交易方式:&nbsp;&nbsp;</label>
                    <select class="col-md-5" id="type">
                        <option value="0" >全部</option>
                        <option value="1" {if $type=='1'}selected = "selected"{/if}>用户充值</option>
                        <option value="2" {if $type=='2'}selected = "selected"{/if}>赠送给其他账户</option>
                        <option value="5" {if $type=='5'}selected = "selected"{/if}>购物返还</option>
                        <option value="11" {if $type=='11'}selected = "selected"{/if}>后台充值</option>
                        <option value="12" {if $type=='12'}selected = "selected"{/if}>后台扣除</option>
                    </select>
                </div>
                <div class="col-md-4 no-margin-right no-padding-right">
                    <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 帐号:&nbsp;&nbsp;</label>
                    <input type="text" id="launch" class="col-sm-6">
                    <input type="hidden" id="url" value="{:url('marketing/info')}"/>
                </div>
                <div class="col-md-4">
                    <div class="input-prepend input-group">
                        <span class="add-on input-group-addon"><i class="glyphicon glyphicon-calendar fa fa-calendar"></i></span>
                        {if empty($date)}
                            <input class="date" id="Date" type="date" value="">
                        {else /}
                            <input class="date" id="Date" type="date" value="{$date|date='Y-m-d' ,###}">
                        {/if}
                    </div>
                </div>
                <button type="submit" id="searchBtn" style="margin-left: 30px;" class="dt-button buttons-collection buttons-colvis btn btn-white btn-primary btn-bold" tabindex="0" aria-controls="dynamic-table" data-original-title="" title="查询"><span><i class="fa fa-search bigger-110 blue"></i></span></button>
            </div>
        </from>
    </div><!-- /.row -->
    {if !empty($list)}
        <div class="row">
            <div class="col-xs-12">
                <table id="simple-table" class="table  table-bordered table-hover">
                    <thead>
                    <tr>
                        <th class="center">序号</th>
                        <th class="center">帐号</th>
                        <th class="center">姓名</th>
                        <th class="center">交易方式</th>
                        <th class="center">数量</th>
                        <th class="center">剩余营销分</th>
                        <th class="center">发起账号</th>
                        <th class="center">收到帐号</th>
                        <th class="center">交易时间</th>
                    </tr>
                    </thead>

                    <tbody>
                    {foreach $list as $key => $val}
                    <tr  class="center">
                        <td>{$key+1}</td>
                        <td>{$val['phone']}</td>
                        <td>{$val['relname']}</td>
                        <td>{$val['type']}</td>
                        {if condition="$val['type'] eq '赠送给其他账户' or $val['type'] eq '后台扣除'"}
                        <td style="color: red">-{$val['amount']}</td>
                        {else /}
                        <td style="color: green">+{$val['amount']}</td>
                        {/if}
                        <td>{$val['total']}</td>
                        <td>{$val['from']}</td>
                        <td>{$val['src']}</td>
                        <td class="dateval">{$val['create_time']|date="Y-m-d H:i" ,###}</td>
                    </tr>
                    {/foreach}
                    </tbody>
                </table>
                {$page_html['html']}
            </div><!-- /.span -->
        </div><!-- /.row -->
    {else/}
        <div class="row" style="font-size: 14px;margin-top: 50px"><center> {$message}</center></div>
    {/if}
</div>
<script>
    $(function () {
        $("#searchBtn").click(function () {
            var url= $("#url").val();
            var reg = /^1[3578]\d{9}$/;
            var type = $("#type").val();
            var mobile = $("#launch").val();
            var Date = $("#Date").val();
            var text_href = "?type="+type;
            if(mobile!=""){
                if(reg.test(mobile)){
                    text_href += "&mobile="+mobile;
                }else{
                    alert("请输入正确的手机号码");
                    return;
                }
            }
            if(Date!=''){
                text_href += "&date="+Date;
            }
            if(mobile!=''){
                location.href=url.split('?')[0]+text_href;
            }
            else{
                location.href=location.href.split('?')[0]+text_href;
            }
        });
    })
</script>

